//
// Created on 2024/3/12.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef OHOS_GLOBALINFOMAP_H
#define OHOS_GLOBALINFOMAP_H

#include "VideoPlayerInfo.h"
#include <bits/alltypes.h>
#include <map>
#include <sys/stat.h>
class GlobalInfoMap {
    
    public:
        static GlobalInfoMap *getInstance() {
            if(globalInfoMap == nullptr){
                globalInfoMap = new GlobalInfoMap();
            }
//             if(globalInfoMap->videoPlayerGlobalMap == nullptr){
//                 globalInfoMap->videoPlayerGlobalMap = new std::unordered_map<int32_t, VideoPlayerInfo *>();
//             }
            return globalInfoMap;
        }

    private:
        static GlobalInfoMap *globalInfoMap;
        std::unordered_map<int32_t, VideoPlayerInfo*> videoPlayerGlobalMap;
    
    private:
        GlobalInfoMap();
        ~GlobalInfoMap();
    public:
        VideoPlayerInfo *getVideoPlayerInfo(int32_t viewTag);
        void addVideoPlayerInfo(int32_t viewTag, VideoPlayerInfo *videoPlayerInfo);
        void deleteVideoByTag(int32_t viewTag);

};

#endif //OHOS_GLOBALINFOMAP_H
